USE [Clinic]
GO
/******    ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[up_HomeostazaInsert]
		  @HomeostazaID int
		, @Date smalldatetime
		, @Kamerno nvarchar(50)
		, @Pofoni nvarchar(50)
		, @Kurvene nvarchar(50)
		, @Susirvane nvarchar(50)
		, @Protromb nvarchar(50)
		, @TrombVreme nvarchar(50)
		, @RekalifikacionnoVreme nvarchar(50)
		, @HeparinovTolerans nvarchar(50)
		, @Fibrinogen nvarchar(50)
		, @Ch nvarchar(50)
		, @H nvarchar(50)
		, @Am nvarchar(50)
		, @patientID int
		, @Option1 nvarchar(50)
		, @Option2 nvarchar(50)
		, @Option3 nvarchar(50)
		
AS
BEGIN
	SET NOCOUNT ON;
	INSERT INTO [Homeostaza]
	(
		  [Data]
		, [Kamerno]
		, [Pofoni]
		, [Kurvene]
		, [Susirvane]
		, [Protromb]
		, [TrombVreme]
		, [RekalifikacionnoVreme]
		, [HeparinovTolerans]
		, [Fibrinogen]
		, [Ch]
		, [H]
		, [Am]
		, [patientID]
		, [Option1]
		, [Option2]
		, [Option3]
	) 
	VALUES 
	(
		  @Date
		, @Kamerno
		, @Pofoni
		, @Kurvene
		, @Susirvane
		, @Protromb
		, @TrombVreme
		, @RekalifikacionnoVreme
		, @HeparinovTolerans
		, @Fibrinogen
		, @Ch
		, @H
		, @Am
		, @patientID
		, @Option1
		, @Option2
		, @Option3
	)		
END

/******    ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[up_HomeostazaDelete]
	  @HomeostazaID int
	
AS
BEGIN
	SET NOCOUNT ON;
	DELETE FROM [Homeostaza]
	WHERE [HomeostazaID] = @HomeostazaID
END

/******    ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[up_HomeostazaUpdate]
		  @HomeostazaID int
		, @Date smalldatetime
		, @Kamerno nvarchar(50)
		, @Pofoni nvarchar(50)
		, @Kurvene nvarchar(50)
		, @Susirvane nvarchar(50)
		, @Protromb nvarchar(50)
		, @TrombVreme nvarchar(50)
		, @RekalifikacionnoVreme nvarchar(50)
		, @HeparinovTolerans nvarchar(50)
		, @Fibrinogen nvarchar(50)
		, @Ch nvarchar(50)
		, @H nvarchar(50)
		, @Am nvarchar(50)
		, @patientID int
		, @Option1 nvarchar(50)
		, @Option2 nvarchar(50)
		, @Option3 nvarchar(50)
AS
BEGIN
	SET NOCOUNT ON;
	UPDATE [Homeostaza]
	SET 
		  [Data] = @Date
		, [Kamerno] = @Kamerno
		, [Pofoni] = @Pofoni
		, [Kurvene] = @Kurvene
		, [Susirvane] = @Susirvane
		, [Protromb] = @Protromb
		, [TrombVreme] = @TrombVreme
		, [RekalifikacionnoVreme] = @RekalifikacionnoVreme
		, [HeparinovTolerans] = @HeparinovTolerans
		, [Fibrinogen] = @Fibrinogen
		, [Ch] = @Ch
		, [H] = @H
		, [Am] = @Am
		, [patientID] = @patientID
		, [Option1] = @Option1
		, [Option2] = @Option2
		, [Option3] = @Option3
	WHERE 
		[HomeostazaID] = @HomeostazaID
END

/******    ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[up_HomeostazaGetAllByPatientID]
	  @PatientID int
	
AS
BEGIN
	SET NOCOUNT ON;
	SELECT *
	FROM [Homeostaza]
	WHERE 
		[PatientID] = @PatientID
END